home *** CD-ROM | disk | FTP | other *** search
/ Champak 40 / Vol 40.iso / games / table_so.swf / scripts / frame_1 / DoAction_2.as next >
Encoding:
Text File  |  2007-03-21  |  5.3 KB  |  168 lines

  1. function randRange(min, max)
  2. {
  3.    var _loc1_ = Math.floor(Math.random() * (max - min + 1)) + min;
  4.    return _loc1_;
  5. }
  6. MovieClip.prototype.bounceIn = function(delay, callback)
  7. {
  8.    this._visible = false;
  9.    xFinish = this._x;
  10.    yFinish = this._y;
  11.    rotFinish = this._rotation;
  12.    this._xscale = 0;
  13.    this._yscale = 0;
  14.    this._visible = true;
  15.    var startTime = getTimer();
  16.    this.onEnterFrame = function()
  17.    {
  18.       currentTime = getTimer();
  19.       if(currentTime >= startTime + delay)
  20.       {
  21.          this.gotoAndPlay(2);
  22.          var _loc3_ = new mx.transitions.Tween(this,"_xscale",mx.transitions.easing.Elastic.easeOut,0,100,1,true);
  23.          var _loc2_ = new mx.transitions.Tween(this,"_yscale",mx.transitions.easing.Elastic.easeOut,0,100,1,true);
  24.          xtween.onMotionFinished = callback;
  25.          delete this.onEnterFrame;
  26.       }
  27.    };
  28. };
  29. MovieClip.prototype.bounceFinal = function(delay, callback)
  30. {
  31.    this._visible = false;
  32.    xFinish = this._x;
  33.    yFinish = this._y;
  34.    rotFinish = this._rotation;
  35.    this._xscale = 0;
  36.    this._yscale = 0;
  37.    this._visible = true;
  38.    var startTime = getTimer();
  39.    this.onEnterFrame = function()
  40.    {
  41.       currentTime = getTimer();
  42.       if(currentTime >= startTime + delay)
  43.       {
  44.          var _loc3_ = new mx.transitions.Tween(this,"_xscale",mx.transitions.easing.Elastic.easeOut,0,100,1,true);
  45.          var _loc2_ = new mx.transitions.Tween(this,"_yscale",mx.transitions.easing.Elastic.easeOut,0,100,1,true);
  46.          xtween.onMotionFinished = callback;
  47.          delete this.onEnterFrame;
  48.       }
  49.    };
  50. };
  51. MovieClip.prototype.bounceBtnIn = function(amount)
  52. {
  53.    var _loc3_ = new mx.transitions.Tween(this,"_xscale",mx.transitions.easing.Elastic.easeOut,this._xscale,amount,1,true);
  54.    var _loc2_ = new mx.transitions.Tween(this,"_yscale",mx.transitions.easing.Elastic.easeOut,this._yscale,amount,1,true);
  55. };
  56. MovieClip.prototype.bounceBtnOut = function()
  57. {
  58.    var _loc3_ = new mx.transitions.Tween(this,"_xscale",mx.transitions.easing.Elastic.easeOut,this._xscale,90,1,true);
  59.    var _loc2_ = new mx.transitions.Tween(this,"_yscale",mx.transitions.easing.Elastic.easeOut,this._yscale,90,1,true);
  60. };
  61. MovieClip.prototype.bounceOut = function(delay, callback)
  62. {
  63.    this._visible = false;
  64.    var _loc3_ = this._x;
  65.    var _loc2_ = this._y;
  66.    var _loc6_ = this._rotation;
  67.    this._xscale = 100;
  68.    this._yscale = 100;
  69.    this._visible = true;
  70.    var startTime = getTimer();
  71.    this.onEnterFrame = function()
  72.    {
  73.       currentTime = getTimer();
  74.       if(currentTime >= startTime + delay)
  75.       {
  76.          var _loc3_ = new mx.transitions.Tween(this,"_xscale",mx.transitions.easing.Elastic.easeOut,100,0,1.5,true);
  77.          var _loc2_ = new mx.transitions.Tween(this,"_yscale",mx.transitions.easing.Elastic.easeOut,100,0,1.5,true);
  78.          xtween.onMotionFinished = callback;
  79.          delete this.onEnterFrame;
  80.       }
  81.    };
  82. };
  83. MovieClip.prototype.fadeOut = function(delay, callback)
  84. {
  85.    this._alpha = 100;
  86.    var startTime = getTimer();
  87.    this.onEnterFrame = function()
  88.    {
  89.       currentTime = getTimer();
  90.       if(currentTime >= startTime + delay)
  91.       {
  92.          var _loc2_ = new mx.transitions.Tween(this,"_alpha",mx.transitions.easing.Regular.easeOut,100,0,1.5,true);
  93.          _loc2_.onMotionFinished = function()
  94.          {
  95.             this._visible = false;
  96.             this._alpha = 100;
  97.             callback;
  98.          };
  99.          delete this.onEnterFrame;
  100.       }
  101.    };
  102. };
  103. MovieClip.prototype.slide = function(delay, callback)
  104. {
  105.    this._visible = false;
  106.    var xFinish = this._x;
  107.    this._x = Stage.width + this._width;
  108.    this._visible = true;
  109.    var startTime = getTimer();
  110.    this.onEnterFrame = function()
  111.    {
  112.       currentTime = getTimer();
  113.       if(currentTime >= startTime + delay)
  114.       {
  115.          var _loc2_ = new mx.transitions.Tween(this,"_x",mx.transitions.easing.Elastic.easeOut,this._x,xFinish,1,true);
  116.          _loc2_.onMotionFinished = callback;
  117.          delete this.onEnterFrame;
  118.       }
  119.    };
  120. };
  121. ScaleRange = 350;
  122. ScaleMin = 150;
  123. Rotation = Math.random() * 4;
  124. angle = 0;
  125. angleRate = 0.1;
  126. max = 12;
  127. vx = randRange(- max,max);
  128. vy = randRange(- max,max);
  129. rot = randRange(-2,2);
  130. mouseX = _root._xmouse;
  131. mouseY = _root._ymouse;
  132. oldMouseX = mouseX;
  133. oldMouseY = mouseY;
  134. totalWidth = preloader_mc.percentbar_mc._width;
  135. preloader_mc.percentbar_mc._width = 0;
  136. preloader_mc.kPercent.text = "0%";
  137. preloader_mc.onEnterFrame = function()
  138. {
  139.    var _loc4_ = _root.getBytesLoaded();
  140.    var _loc3_ = _root.getBytesTotal();
  141.    if(_loc3_ != -1)
  142.    {
  143.       var _loc6_ = Math.round(_loc4_ / 1024);
  144.       var _loc5_ = Math.round(_loc3_ / 1024);
  145.       percent = Math.round(_loc6_ / _loc5_ * 100);
  146.       if(isNaN(percent))
  147.       {
  148.          this.kPercent.text = "0%";
  149.       }
  150.       else
  151.       {
  152.          this.kPercent.text = percent + "%";
  153.          this.percentbar_mc._width = totalWidth * (percent / 100);
  154.       }
  155.       if(_loc4_ == _loc3_ && _loc3_ > 0)
  156.       {
  157.          delete this.onEnterFrame;
  158.          gotoAndStop("start");
  159.          play();
  160.       }
  161.       else if(_loc4_ == -1)
  162.       {
  163.          failureReport_txt.text = "The file is not currently available. Please try again later. If you continue to receive this message, please contact the system administrator.";
  164.       }
  165.    }
  166. };
  167. stop();
  168.